<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>用户信息统计</title>
<link rel="stylesheet" href='css/style.css' type="text/css">
</head>
<script type="text/javascript" src="js/WdatePicker.js"></script>
<script type='text/javascript' src='js/prototype.js'></script>
<script type='text/javascript' src='js/sha1.js'></script>
<script type='text/javascript' src='js/public.js'></script>
	
<script type="text/javascript">

	function sd(){
		
		var year1 = document.getElementById("lecyear1").value;
		var year2 = document.getElementById("lecyear2").value;
		var lecterm = document.getElementById("lecterm").value;
		var lecyear = year1 + year2 + lecterm;
		var userEnterYear = document.getElementById("grade1").value;
        if(year1==""||year2==""||lecterm==""||userEnterYear=="")
        	{alert("请输入必要信息！");}
        else{
		var params = "lecYear=" + encodeURIComponent(lecyear) + "&enterYear=" + encodeURIComponent(userEnterYear);
	
		new Ajax.Request("json/showStudentsInfo",{
			method : "post",
			parameters : params,
			onComplete : function(request) {
				var res = request.responseText.evalJSON();
				 var start="<table  width='1000' border='1'  style=' border:1px solid #999; margin-left:150px; border-collapse:collapse; margin-top:50px; text-align:center'><tr><td>学号</td><td>姓名</td><td>班级</td><td>年级</td><td>签到次数</td><td>报名次数</td> </tr>";
				 var stop="</table>";
				 var cont="";
				 document.getElementById("show").innerHTML = "";
				for ( var i = 0; res["result"]["userId" + i] != null; i++) {
					var tmp = "<tr><td>"+res["result"]["userId" + i]
					+"</td><td>"+res["result"]["userName" + i]+"</td><td>"+res["result"]["major" + i]+res["result"]["userclass" + i]+"</td><td>"+res["result"]["enterYear" + i]+"</td><td>"+res["result"]["countRegistedLectures" + i]
					+"</td><td>"+res["result"]["countLectures" + i]+"</td></tr>";
					cont += tmp;

				}
				 cont=start+cont+stop;
                 document.getElementById("show").innerHTML +=cont;
                 document.getElementById("amout").innerHTML ="总人数："
						+res["result"]["amount"];
			},
			asynchronous : false
		});
        }
		}
</script>

<body>
<div style="text-align: center;">阶段:
	<input name="lecyear1" type="text" id="lecyear1" size="15" onclick="WdatePicker({dateFmt:'yyyy'})">——
	<input name="lecyear2" type="text" id="lecyear2" size="15" onclick="WdatePicker({dateFmt:'yyyy'})">
	<select name="lecterm" id="lecterm" style=" width: 100px">
		<option value="1">第一学期</option>
		<option value="2">第二学期</option>
   </select>
    &nbsp;&nbsp;&nbsp;&nbsp;年级:
	<input name="grade1" type="text" id="grade1" onclick="WdatePicker({dateFmt:'yyyy'})">
    <input type="button" onclick="sd()" value="查询"></div><div id="amout" style="text-align: center;"></div>
<div id="show">
	


	</div>
</body>
</html>